<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      #main {
        width: 600px;
        height: 400px;
        /* background-color: aqua; */
      }
    </style>
  </head>
  <body>
    <div id="main"></div>
    <script src="./lib/echarts.min.js"></script>
    <script>
      var myChart = echarts.init(document.getElementById('main'))
      var option = {
        grid: {
          // 设置上下左右的间隙
          top: '25%',
          left: '25%',
          right: '10%',
          bottom: '10%',
        },
        // x轴设置
        xAxis: {
          type: 'category',
          data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
          // 线段设置
          axisLine: {
            // 线的样式
            lineStyle: {
              type: 'dashed',
              color: '#d4d4d6',
            },
          },
          axisLabel: {
            color: 'aqua',
          },
        },
        title: {
          text: '汪亮',
          subtext: '第十二组',
          top: '10%',
          left: '25%',
        },
        yAxis: {
          type: 'value',
          // 分割线设置
          splitLine: {
            // 线的样式
            lineStyle: {
              type: 'dashed',
              color: '#d4d4d6',
            },
          },
        },
        // 颜色
        color: [
          // 渐变
          {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: '#34d29a', // 0% 处的颜色
              },
              {
                offset: 1,
                color: 'red', // 100% 处的颜色
              },
            ],
            global: false, // 缺省为 false
          },
          {
            type: 'radial',
            x: 0.5,
            y: 0.5,
            r:0.8,
            colorStops: [
              {
                offset: 0,
                color: '#d8eafb', // 0% 处的颜色
              },
              {
                offset: 1,
                color: 'aqua', // 100% 处的颜色
              },
            ],
            global: false, // 缺省为 false
          },
        ],
        series: [
          // 柱状图 给多个图形,会有柱形
          {
            data: [120, 200, 150, 80, 70, 110, 130],
            type: 'bar',
            showBackground: true,
          },
          {
            data: [120, 200, 150, 80, 70, 110, 130],
            type: 'bar',
            showBackground: true,
          },
        ],
      }
      myChart.setOption(option)
    </script>
  </body>
</html>
